'use strict'

const koa = require('koa');
const bodyparser = require('koa-bodyparser');
const cors = require('koa-cors');
const router = require('./router');
const { sync, Products } = require('./model');

let app = new koa();

sync().then(() => {
    Products.bulkCreate([
        {
            productname: 'iphone',
            price: 1234,
        },
        {
            productname: 'xiaomi',
            price: 1999,
        },
    ])
});



app.use(cors());
app.use(bodyparser());
app.use(router());

app.listen(8080)